#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e6 + 5;

int n;
string s;
struct Node {
  char val;  // 0 1 表示 val, & | 表示运算
  int ch[2];
} tr[N];
int newnode(char c) {
  static int tot = 0;
  ++tot;
  tr[tot].val = c;
  return tot;
}
bool stop(char c, char d) { return d == '(' || c == '&' && d == '|'; }
int build() {
  s = '(' + s + ')';
  stack<int> data;
  stack<char> op;
  for (char c : s) {
    if (c == '0' || c == '1')
      data.push(newnode(c));
    else if (c == '(')
      op.push(c);
    else {
      while (op.size() && !stop(c, op.top())) {
        char d = op.top();
        op.pop();
        int r = data.top();
        data.pop();
        int l = data.top();
        data.pop();
        int p = newnode(d);
        tr[p].ch[0] = l, tr[p].ch[1] = r;
        data.push(p);
      }
      if (c == ')') {
        if (op.size() && op.top() == '(') op.pop();
      } else {
        op.push(c);
      }
    }
  }
  return data.top();
}
int a, b;
int dfs(int p) {
  if (tr[p].val == '0' || tr[p].val == '1') {
    return tr[p].val - '0';
  } else {
    int x = dfs(tr[p].ch[0]);
    if (x == 0 && tr[p].val == '&') {
      a++;
      return 0;
    }
    if (x == 1 && tr[p].val == '|') {
      b++;
      return 1;
    }
    int y = dfs(tr[p].ch[1]);
    if (tr[p].val == '&')
      return x * y;
    else
      return x + y;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> s;
  int root = build();
  cout << dfs(root) << endl;
  cout << a << ' ' << b;
  return 0;
}